import requests
import os

def download_ppt(url, save_path):
    """
    下载远程 PPT 文件并保存到本地。

    :param url: str, PPT 文件的 URL 地址
    :param save_path: str, 保存文件的路径（默认为 downloaded_ppt.pptx）
    :return: bool, 下载成功返回 True，失败返回 False
    """
    try:
        response = requests.get(url, stream=True)
        response.raise_for_status()  # 检查请求是否成功

        with open(save_path, 'wb') as file:
            for chunk in response.iter_content(chunk_size=1024):
                if chunk:
                    file.write(chunk)

        print(f"PPT 下载成功，保存路径为: {os.path.abspath(save_path)}")
        return True
    except requests.exceptions.RequestException as e:
        print(f"下载失败: {e}")
        return False

if __name__ == "__main__":
    url = "https://lf-bot-studio-plugin-resource.coze.cn/obj/bot-studio-platform-plugin-tos/artist/image/762c03e7b1a142358a58b11d5a4bf95b.ppt"  # 替换为实际的 PPT 文件 URL
    download_ppt(url)